<%@page import="java.text.SimpleDateFormat"%>
<%@page import="java.util.Date"%>
<%@page import="com.wanmait.travel.vo.Userinfo"%>
<%@page import="com.wanmait.travel.vo.Comment"%>
<%@page import="java.util.List"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
    <%
    String path=request.getServletContext().getContextPath();
    List<Userinfo>  userinfos =(List<Userinfo>)request.getAttribute("userinfos");
    %>
<meta charset="UTF-8">
<jsp:include page="/managerinc/header.jsp"></jsp:include>
<title>用户管理</title>
<section>
<h2>用户管理</h2>
<form action="<%=path%>/ManagerController?action=searchComment" method="post">
<input type="text" value="" name="searchComment">
<input type="submit" value="搜索" >
</form>
<table width="100%" height="80px" border="1">
<tr>
<th>用户昵称</th>
<th>用户真实姓名</th>
<th>用户电话</th>
<th>用户年龄</th>
<th>用户加入时间</th>
<th>用户性别</th>
<th>选项</th>
</tr>
<%
for(int i =0;userinfos!=null&&i<userinfos.size();i++){
	Userinfo userinfo=userinfos.get(i);
%>
<tr>
<th><%=userinfo.getNickname() %></th>
<th><%=userinfo.getRealName() %></th>
<th><%=userinfo.getPhone() %></th>
<%
Date date=new Date();
SimpleDateFormat format=new SimpleDateFormat("yyyy-MM-dd");
String birthday=format.format(userinfo.getBirthday());
String today=format.format(date);

Date beginDate=format.parse(birthday);
Date endDate=format.parse(today);

long day=(endDate.getTime()-beginDate.getTime())/(1000*60*60*24*365)/20;
%>
<th><%=day %></th>
<th><%=userinfo.getJoinDate() %></th>
<th><%=userinfo.getGender() %></th>
<th>
<a href="<%=path %>/ManagerController?action=userPay&userId=<%=userinfo.getId() %>">购物记录</a>
<a href="<%=path %>/ManagerController?action=userCommentSearch&userId=<%=userinfo.getId() %>">用户评论</a>
</th>
</tr>
	<%} %>
</table>
</section>
<jsp:include page="/managerinc/footer.jsp"></jsp:include>